<?php

declare (strict_types = 1);

namespace app\controller\admin\system;

use app\BaseController;
use app\service\admin\system\LoggerService;

class Logger extends BaseController
{
    protected $loggerServer;

    public function initialize()
    {
        $this->loggerServer = make(LoggerService::class);
    }
    /**
     * 登录日志列表
     */
    public function loginLogList()
    {
        return $this->success($this->loggerServer->loginLogList($this->paging()));
    }
    /**
     * 操作日志列表
     */
    public function operLogList()
    {
        return $this->success($this->loggerServer->operLogList($this->paging()));
    }
    /**
     * 操作日志详情
     */
    public function operLogInfo()
    {
        $param = $this->request->get();
        return $this->success($this->loggerServer->operLogInfo((int) $param['id']));
    }
    /**
     * 操作日志 - 当前用户
     */
    public function userOperLog()
    {
        $param = $this->paging();
        $param['username'] = $this->request->auth->username;
        return $this->success($this->loggerServer->operLogList($param));
    }
    /**
     * 系统日志列表
     */
    public function systemLogList()
    {
        return $this->success($this->loggerServer->systemLogList($this->paging()));
    }
    /**
     * 系统日志列表
     */
    public function systemLogEcharts()
    {
        return $this->success($this->loggerServer->systemLogEcharts($this->request->get()));
    }
}    
